﻿using System;

namespace Reactor.Messaging.ServiceBus.Receiving
{
    /// <summary>
    /// Interface for message receiver classes.
    /// </summary>
    public interface IReceiver : IDisposable
    {
        /// <summary>
        /// Occurs when a message is received.
        /// </summary>
        event EventHandler<MessageEventArgs> MessageReceived;

        /// <summary>
        /// Starts this instance.
        /// </summary>
        void Start();

        /// <summary>
        /// Stops this instance.
        /// </summary>
        void Stop();

        /// <summary>
        /// Gets a value indicating whether this instance is running.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is running; otherwise, <c>false</c>.
        /// </value>
        bool IsRunning { get; }

        /// <summary>
        /// Gets or sets the MessagingChannel.
        /// </summary>
        /// <value>The MessagingChannel.</value>
        IMessagingChannel MessagingChannel { get; set; }
    }
}
